import { DataTypes } from 'sequelize'
const seq = require('../db/seq')

const NoticesModels: any = seq.define('notices', {
  id: {
    autoIncrement: true,
    type: DataTypes.INTEGER,
    allowNull: false,
    primaryKey: true
  },
  content: {
    type: DataTypes.STRING(45),
    allowNull: true
  },
  priority: {
    type: DataTypes.INTEGER,
    allowNull: true
  },
  picture: {
    type: DataTypes.STRING(200),
    allowNull: false
  },
  picture_name: {
    type: DataTypes.STRING(45),
    allowNull: true
  },
  publish_time: {
    type: DataTypes.DATEONLY,
    allowNull: true
  },
  delete_time: {
    type: DataTypes.DATEONLY,
    allowNull: true
  }
}, {
  tableName: 'notices',
  timestamps: false,
  indexes: [
    {
      name: "PRIMARY",
      unique: true,
      using: "BTREE",
      fields: [
        { name: "id" },
      ]
    },
  ]
});

module.exports = NoticesModels